package com.dongdongshop.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdongshop.data.Result;
import com.dongdongshop.em.ConstantEnum;
import com.dongdongshop.pojo.TbSeller;
import com.dongdongshop.service.TbSellerService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("seller")
public class TbSellerController {



    @Reference
    private TbSellerService tbSellerService;

    @RequestMapping("list")
    public String list(){
        return "/admin/seller";
    }


    @RequestMapping("getSellerInfo")
    @ResponseBody
    public Result getSellerInfo(TbSeller tbSeller){
        List<TbSeller> list = tbSellerService.getSellerInfo(tbSeller);
        return Result.build(ConstantEnum.SUCCESS).setResult(list);
    }

    @RequestMapping("getSellerByIdInfo")
    @ResponseBody
    public Result getSellerByIdInfo(TbSeller tbSeller){
        TbSeller seller = tbSellerService.getSellerByIdInfo(tbSeller);
        return Result.build(ConstantEnum.SUCCESS).setResult(seller);
    }

    @RequestMapping("sellerCheck")
    @ResponseBody
    public Result sellerCheck(TbSeller tbSeller){
        tbSellerService.sellerCheck(tbSeller);
        return Result.build(ConstantEnum.SUCCESS);
    }


}
